Added ability to add actions (buttons) within the attachment#32
Added ability to add actions (buttons) within the attachment#32craigwillis85 wants to merge 3 commits intosagebind:masterfrom craigwillis85:master
Conversation
src/Message/Attachment.php
Outdated
| * @param array $actions Attachment actions | ||
| */ | ||
| public function __construct($title, $text, $fallback = null, $color = null, $pretext = null, array $fields = []) | ||
| public function __construct($title, $text, $fallback = null, $callback_id, $color = null, $pretext = null, array $fields = [], array $actions = []) |
There was a problem hiding this comment.
One thought here, you probably want to use $callback_id = null in the constructor here, otherwise it breaks the existing API contract for the Attachment object and will break code on upgrade.
If you really meant to require the field, you probably should move it before $fallback as this order would require all constructor calls to also specify a value, or null, for $fallback as well.
There was a problem hiding this comment.
If it is changed to $callback_id = null then it should also be moved to the end of the constructor, after all the existing parameters, otherwise it will still be a breaking change.
There was a problem hiding this comment.
Yeah, I was having a small brain-fart on that positioning... 😨
Fixed constructor argument
|
@bdaroz I've updated the code as mentioned in the comments |
Hi
I have added a little bit of code to make it so that actions can be added within an attachment. Feel free to change if it doesn't conform